
Partial Class LoginDetails
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then
            ' make sure the page can't be accessed in real mode
            If ConfigurationManager.AppSettings("mode") = "Real" Then
                MessagePanel.Visible = True
                UsersRolesPanel.Visible = False
            End If

            UserList.DataSource = Membership.GetAllUsers()
            UserList.DataBind()
            UserList.SelectedIndex = 0

            RoleList.DataSource = Roles.GetAllRoles()
            RoleList.DataBind()
            RoleList.SelectedIndex = 0
        End If

    End Sub

    Protected Sub UserList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UserList.SelectedIndexChanged

        RolesForUser.DataSource = Roles.GetRolesForUser(UserList.SelectedValue)
        RolesForUser.DataBind()

    End Sub

    Protected Sub RoleList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RoleList.SelectedIndexChanged

        UsersInRole.DataSource = Roles.GetUsersInRole(RoleList.SelectedValue)
        UsersInRole.DataBind()

    End Sub

End Class
